package cn.maihe.elg.operation.centers.follow.enums;

import cn.maihe.elg.operation.model.enums.CenterNoEnum;

import java.util.Arrays;

/**
 * @Description
 * @Author caixh
 * @Date 2021/10/25.
 * 光泽县[350723]
 * 蒲城县[350722]
 */
public enum BeianDiquCode {

    TEST("x00000",CenterNoEnum.SANMING,"三明县开发测试"),
    NINGHUA("x00004",CenterNoEnum.SANMING,"三明县"),
    GUANGZE("350723",CenterNoEnum.GUANGZE,"光泽县"),
//    PUCHENG("350722",CenterNoEnum.PUCHENG,"蒲城县"),
    YOUXI("x60006",CenterNoEnum.YOUXI,"尤溪县"),
    JIANGLE("x60007",CenterNoEnum.JIANGLE,"将乐县"),
    SANMING("x350400",CenterNoEnum.SANMING,"三明市")

    ;
    private String code;
    private CenterNoEnum centerNo;
    private String desc;

    BeianDiquCode( String code, CenterNoEnum centerNo, String desc){
        this.code = code;
        this.centerNo = centerNo;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public CenterNoEnum getCenterNo() {
        return centerNo;
    }

    public String getDesc() {
        return desc;
    }

    public static BeianDiquCode resolve(String code) {
        return Arrays.stream(values()).filter(o -> o.getCode().equals(code)).findFirst().orElseThrow(() -> new RuntimeException("查无此备案地区[" + code + "]记录"));
    }
}
